package com.chap9;
import javax.swing.*;
import java.awt.*;
public class demoBorder extends JFrame {
    JButton jbWest,jbEast,jbNorth,jbSouth,jbCenter;//按钮组件变量
    public static void main(String[] args) {
        demoBorder MyBorder=new demoBorder();
    }
    public demoBorder(){
        jbWest=new JButton("West");//创建按钮
        jbEast=new JButton("East");
        jbNorth=new JButton("North");
        jbSouth=new JButton("South");
//        jbCenter=new JButton("Center");
        //
        this.setLayout(new BorderLayout());
        this.add(jbWest,BorderLayout.WEST);
        this.add(jbEast,BorderLayout.EAST);
        this.add(jbNorth,BorderLayout.NORTH);
        this.add(jbSouth,BorderLayout.SOUTH);
//        this.add(jbCenter,BorderLayout.CENTER);
        //定义窗口
        setTitle("MyBorder");
        this.setSize(400,500);
        this.setLocation(300,300);
        this.setVisible(true);//窗口可见
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);//
    }
}
